//
//  DFStatusBottomView.swift
//  FlyBlog
//
//  Created by FEI on 16/4/15.
//  Copyright © 2016年 FEI. All rights reserved.
//

import UIKit

class DFStatusBottomView: UIView {
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareUI()
    }

    private func prepareUI() {
        addSubview(retweetButton)
        addSubview(commenButton)
        addSubview(likeButton)

        retweetButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
        }

        commenButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(retweetButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(retweetButton)
        }

        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commenButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            make.width.equalTo(commenButton)
        }


    }



    //MARK:懒加载
    private lazy var retweetButton: UIButton = {
        let button = UIButton()

        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)

        button.setImage(UIImage(named: "timeline_icon_retweet"), forState: UIControlState.Normal)
        button.setTitle("转发", forState: UIControlState.Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)

        return button
    }()

    private lazy var commenButton: UIButton = {
        let button = UIButton()

        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)

        button.setImage(UIImage(named: "timeline_icon_comment"), forState: UIControlState.Normal)
        button.setTitle("评论", forState: UIControlState.Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)

        return button
    }()

    private lazy var likeButton: UIButton = {
        let button = UIButton()

        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)

        button.setImage(UIImage(named: "timeline_icon_unlike"), forState: UIControlState.Normal)
        button.setTitle("赞", forState: UIControlState.Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        return button
    }()
}
